<template>
  <header class="nav-bar">
    <div class="logo">必应 <span class="slogan">一切需求，有求必应</span></div>
    <nav class="nav-links">
      <router-link
        v-for="item in navs"
        :key="item.path"
        :to="item.path"
        class="nav-link"
        :class="{ active: isActive(item.path) }">
        {{ item.label }}
      </router-link>
    </nav>
  </header>
</template>
<script setup>
import { useRoute } from "vue-router";
const route = useRoute();
const navs = [
  { label: "首页", path: "/" },
  { label: "需求大厅", path: "/market" },
  { label: "发布需求", path: "/publish" },
  { label: "个人中心", path: "/profile" },
];
function isActive(path) {
  return route.path === path;
}
</script>
<style scoped>
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  height: 64px;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
}
.logo {
  font-size: 22px;
  font-weight: bold;
  color: #1976d2;
  letter-spacing: 2px;
}
.slogan {
  font-size: 14px;
  color: #666;
  margin-left: 12px;
  font-weight: normal;
}
.nav-links {
  display: flex;
  gap: 32px;
}
.nav-link {
  color: #222;
  font-size: 16px;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
}
.nav-link:hover {
  color: #1976d2;
}
.nav-link.active {
  color: #409eff;
  font-weight: bold;
}
</style>
